import requests from "./ajax";
import mockRequests from "./mockAjax";

export const reqgetCategoryList = () => requests.get(`/product/getBaseCategoryList`);
export const reqgetBannerList = () => mockRequests.get(`/banner`);
export const reqgetFloorList = () => mockRequests.get(`/floor`);
export const reqgetSearchInfo = (params) => requests({ url: '/list', method: "post", data: params })
export const reqgetGoodInfo = (params) => requests({ url: `/item/${params}`, method: "get" })
export const reqaddOrUpdateShopCart = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: "post" })
export const reqCartList = () => requests({ url: '/cart/cartList', method: 'get' })
export const reqDeleteCartById = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'delete' });
export const reqUpdateCheckedById = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' });
export const reqGetCode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'get' });
export const reqUserRegister = (data) => requests({ url: '/user/passport/register', data, method: 'post' });
export const reqUserLogin = (data) => requests({ url: '/user/passport/login', data, method: 'post' });
export const reqUserInfo = () => requests({ url: '/user/passport/auth/getUserInfo', method: 'get' });
export const reqLogout = () => requests({ url: '/user/passport/logout', method: 'get' });
//用户收货地址信息
export const reqAddressInfo = () => requests({ url: '/user/userAddress/auth/findUserAddressList', method: 'get' });
//商品清单信息
export const reqOrderInfo = () => requests({ url: '/order/auth/trade', method: 'get' });
//提交订单
export const reqSubmitOrder = (tradeNo, data) => requests({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, data, method: 'post' })
//支付信息
export const reqPayInfo = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'get' });
//支付状态
export const reqPayStatus = (orderId) => requests({ url: `/payment/weixin/queryPayStatus/${orderId}`, method: 'get' });
//获取支付中心的数据
export const reqMyOrderList = (page, limit) => requests({ url: `/order/auth/${page}/${limit}`, method: 'get' });